package work.xiaohong.gupiao.time;

import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import work.xiaohong.gupiao.pojo.HttpResult;

public class JijinHttpUtil {

    public static HttpResult sendGetReq(String url) throws Exception {

        String body= HttpUtil.get(url);

        System.out.println("获取到响应：" + body);

        String result1 = body.substring(body.indexOf("(")+1,body.lastIndexOf(")"));
        HttpResult httpResult = JSON.parseObject(result1, HttpResult.class);

        return httpResult;

    }

    public static void main(String[] args) {
        String url = "http://fundgz.1234567.com.cn/js/004753.js?rt=1615788646293";
        try {
            HttpResult httpResult = sendGetReq (url);
            System.out.println(httpResult);
        } catch (Exception e) {
            e.printStackTrace ( );
        }
    }

}